package com.smr.micservice.diablouser.controller;

import com.smr.micservice.diablouser.feign.MovieFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/user")
@RefreshScope
public class UserController {

    @Autowired
    private MovieFeign movieFeign;

    @Value("${name}")
    private String dataName;

    @GetMapping("/test")
    public String test(String name) {
        log.info("Data:{}", name);
        log.info("Config-Data-Name:{}", dataName);
        return movieFeign.testSome(name);
    }
}
